<template>
	<view>
		<view class="title">{{info.title}}</view>

		<view class="author">
			<text class="author_width">投稿作者：{{info.author||"佚名"}}</text>
			<text class="read_number">阅读量：{{info.read_num||0}}</text>
		</view>

		<view class="content">
			<u-parse :content="info.content"></u-parse>
		</view>

		<!-- <view class="content">{{info.content}}</view> -->
		<u-gap height="100rpx"></u-gap>
	</view>
</template>

<script>
	const db = uniCloud.database();

	export default {
		data() {
			return {
				info: {},
			}
		},
		async onLoad(options) {
			console.log('options', options);
			vk.showLoading('加载中...')

			const bbb = await db.collection("a_article").where({
				_id: options.id
			}).get()
			this.info = bbb.result.data[0]

			const upReadNumber = await db.collection("a_article").where({
				_id: options.id
			}).update({
				read_num: bbb.result.data[0].read_num * 1 + 1
			})
			vk.hideLoading()
		},

		methods: {

		}
	}
</script>

<style>
	.title {
		margin: 20rpx;
		text-align: center;
		font-weight: 600;
		font-size: 32rpx;
	}

	.author {
		display: flex;
		justify-content: space-between;
		margin: 20rpx;
		color: #888;
		font-size: 26rpx;
	}

	.author_width {
		width: 400rpx;
		display: -webkit-box;
		overflow: hidden;
		white-space: normal !important;
		text-overflow: ellipsis;
		word-wrap: break-word;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	.read_number {
		width: 300rpx;
		text-align: right;
		display: -webkit-box;
		overflow: hidden;
		white-space: normal !important;
		text-overflow: ellipsis;
		word-wrap: break-word;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	.content {
		font-size: 30rpx;
		letter-spacing: 2rpx;
		text-indent: 50rpx;
		text-align: justify;
		margin: 0 20rpx;
	}
</style>
